package model

import (
	"gorm.io/gorm"
	"time"
)

type Actor struct {
	// 如果required字段没有收到，错误日志会告知：
	// Error:Field validation for 'User' failed on the 'required' tag
	/*
		binding:"required,gt=10" => 代表该值需要大于10
		time_format:"2006-01-02" time_utc:"1" => 时间格式
		还允许**自定义校验方式：**gopkg.in/go-playground/validator.v8，待完善
	*/
	gorm.Model
	// ID        int32     `json:"id" form:"id" gorm:"primaryKey;autoIncrement;column:id;type:bigint"`
	CreatedAt time.Time `gorm:"type:datetime;default:CURRENT_TIMESTAMP;not null"`
	UpdatedAt time.Time `gorm:"type:datetime;default:CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;not null"`
	DeletedAt time.Time `gorm:"type:datetime;default:null;"`
	Age       int32     `json:"age" form:"age" gorm:"column:age"`
	Name      string    `json:"Name" form:"Name" gorm:"column:name;size:255"`
	Comment   string    `json:"comment" form:"comment" gorm:"column:comment;default:'null comment';size:255"`
}

// TableName 表示配置操作数据库的表名称
func (actor Actor) TableName() string {
	return "actor"
}
